package com.example.petshopping.ui.search;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.flexbox.FlexboxLayout;
import com.example.petshopping.R;

public class SearchActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);

        FlexboxLayout historyItems = findViewById(R.id.history_items);
        String[] historyList = {"这是一条搜索记录", "这是一条搜索记录"};
        for (String text : historyList) {
            TextView tv = new TextView(this);
            tv.setText(text);
            tv.setBackgroundResource(R.drawable.history_item_bg);
            tv.setPadding(30, 16, 30, 16);
            tv.setTextColor(Color.parseColor("#333333"));
            tv.setTextSize(14);
            FlexboxLayout.LayoutParams lp = new FlexboxLayout.LayoutParams(
                FlexboxLayout.LayoutParams.WRAP_CONTENT,
                FlexboxLayout.LayoutParams.WRAP_CONTENT);
            lp.setMargins(0, 0, 20, 20);
            tv.setLayoutParams(lp);
            historyItems.addView(tv);
        }
        // 其他事件绑定（返回、取消、清空等）可根据需要补充
    }
} 